package cn.wolfcode.trip.base.service.impl;


import cn.wolfcode.trip.base.domain.SignIn;

import cn.wolfcode.trip.base.mapper.SignInMapper;

import cn.wolfcode.trip.base.service.ISignInService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SignInServiceImpl implements ISignInService {

    @Autowired
    private SignInMapper signInMapper;




    //新增签到数据
    @Override
    public void save(SignIn signIn) {
        //需要更新签到数据
        signInMapper.insert(signIn);
    }
    //确认是否签到
    @Override
    public SignIn confirm(SignIn signIn) {
        SignIn s = signInMapper.selectSignIn(signIn);
        return s;
    }

    @Override
    public Long getDay(Long userId) {
        Long days = signInMapper.selectDayByUserId(userId);
        return days;
    }

    @Override
    public List<SignIn> listAll(Long userId) {
        List<SignIn> list = signInMapper.selectAll(userId);
        return list;
    }
    //查询某一用户签到的所有日期
    @Override
    public List<Long> listAllDate(Long userId) {

        List<Long> list = signInMapper.selectAllDate(userId);

        return list;
    }
}
